<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>v-model指令</title>
</head>

<body>
    <div id="app">
        <!-- :value 单向数据绑定 -->
        <input type="text" :value="message" name="username" />
        <h1>{{message}}</h1>
        <!-- v-model:value 双向数据绑定 -->
        <!-- @keydown.enter="函数"  @键盘事件.键的修饰符 键盘按下Enter键触发搜索 -->
        <input type="text" v-model:value="message" name="email" 
            @keydown.enter="search" />
    </div>
    <script src="./js/vue.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                message:'hello vue'
            },
            methods:{
                search(){
                    alert(this.message)
                }
            }
        })
    </script>
</body>

</html>